<?php

include("config.php");

session_start();
$user_id = $_POST['myusername'];
#$sql="SELECT * FROM events  INNER JOIN  user_event ON events.event_ID = user_event.event_ID where user_event.username='$user_id' and events.start_date >= now()";
$sql ="select * from user_event eu,events e where eu.event_ID = e.event_ID and eu.username = '$user_id' and e.start_date >= now() group by e.event_name";
$result=mysql_query($sql);

$rows = array();
while($r = mysql_fetch_assoc($result)) {
  $rows[] = $r;
}

echo json_encode($rows);

?>

